#include <iostream>
#include <string>
#include <fstream>
#include "grayscale.h"
#include "image.h"

using namespace std;

void main(int argc, char** argv)
{
	string name;
	
	system("cls");

	if(argc == 1){
		cout << "What image would you like to open for processing?: ";
		cin >> name;
		cout << endl;
	}
	else{
		name = argv[1];
	}
	
	ifstream infile(name.c_str());
	string magicNum;
	infile >> magicNum;
	
	if (magicNum == "P2")
	{
		grayscale grayImage(name);
		grayImage.process();
	}
	else if(magicNum == "P3"){
	        processColor(name);
	}
	else{
		cout << "\a!File not found, program terminating" << endl;
	}
	
}
